{% extends "base.html" %}
{%block title %} 图片采集 {% endblock %}
{%block init_menu %}pick{% endblock %}
{%block content_title %}修改图片采集 - {{rule_base.name}} {% endblock %}
{% block content %}
<script type="text/javascript" src="/static/jquery-1.4.3.min.js"></script>
<script type="text/javascript" src="/static/pick.js"></script>
{% if rule_base %}
<form name="pick_form" method="post" action="/a/pick/edit/{{key_name}}/">
<div class="pick_base">
    <ul>
        <li class="ptitle"><div>采集基础设置 ></div></li>
        <li><div>名称:</div><div><input type="text" value="{{rule_base.name}}" name="pick_name" class="input"></div></li>
        <li><div>采集主域名:</div><div><input type="text" value="{{rule_base.base_url}}" name="base_url" class="url_input"></div></li>
        <li><div>采集方式:</div><div><input type="radio" value="0" name="pick_method" id="pick_method" {% if rule_base.method == 0%} checked{%endif%}>自动采集<input type="radio" value="1" name="pick_method" id="pick_method" {% if rule_base.method == 1%} checked{%endif%}>手动采集</div>{% if rule_base.method == 0%} <div class="pick_method_time">采集时间:<input type="text" value="{{rule_base.method_time}}" name="pick_method_time"></div>{%endif%}</li>
        <li><div>采集图集:</div><div><input type="text" value="{{rule_base.ablum}}" name="ablum" id="ablum" class="input">
        <select name="s_ablum" id="s_ablum">
        <option value="0">选择图集...</option>
        {% for album in albums %}
        <option value="{{album.slug}}">{{album.name}}({{album.count}})</option>
		{% endfor %}
        </select> <a href="/a/album/add/">新建图集</a></div></li>
    </ul>
</div>

<div class="pick_base">
    <ul>
        <li class="ptitle"><div>采集分页设置 ></div></li>
        <li><div>分页类型:</div><div><select name="pick_page_method" id="pick_page_method"><option value="1" {% if rule_base.page_method == 1%} selected{%endif%}>规则模式</option><option value="2" {% if rule_base.page_method == 2%} selected{%endif%}>多个域名</option></select></div></li>
        <li><div>采集域名:</div><div id="pick_page_url">{%for url in rule_base.page_url%}<span class="urls"><input type="text" value="{{url}}" name="pick_page_url[]" class="url_input"> {% if rule_base.page_method == 2 and forloop.counter == 1%} <label class='btn'>新增网址</label>{%endif%}</span>{%endfor%}</div></li>
    </ul>
</div>

<div class="pick_base">
    <ul>
        <li class="ptitle"><div>采集规则设置 ></div></li>
        {%if rule_d%}
        {%for rule in rule_d%}
        <li>
            <div>规则{{forloop.counter}}{%if forloop.counter != 1%}[<label class='btn'>删除</label>]{%endif%}:</div>
            <div>
                  <span>名称:<input type="text" value="{{rule.name}}" name="pick_rule_name[]"  class="input"></span>
                  <span>来源:<input type="text" value="{{rule.sources}}" name="pick_source_name[]"  class="input" {%if forloop.counter == 1%}disabled{%endif%}></span>
                  <span>内容:<textarea name="pick_rule_contents[]">{{rule.data}}</textarea></span>
            </div>
        </li>
        {%endfor%}
        {%endif%}
        <li><div class='btn' id="add_rule">新建规则</div></li>
        <!--li>
            <div>保存设置:</div>
            <div>
                  <span>规则内容名:<input type="text" value="" name="pick_save_rule_name[]"  class="input">
                  保存数据名:<input type="text" value="" name="pick_save_data_name[]"  class="input"></span>
                  <span class='btn' id="add_save">新建保存</span>
            </div>
        </li-->
    </ul>
</div>
<div class="pick_botton"><input type="submit" value="保存"></div>
</form>
{%else%}
没有这个采集规则。
{%endif%}
{% endblock %}